package com.android.likeweixin;

import java.util.Map;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.android.likeweixin.asynctask.AsyncTaskCallback;
import com.android.likeweixin.util.ResolutionUtily;

/**
 * 活动基础管理类。
 * 
 * 1.支持异步任务的统一api.
 * 2.支持对活动们进行统一管理。
 * 3.其他基础性功能还可以在此处添加。
 * 
 * @author  bangyue
 * @version  [版本号, 2014-4-4]
 */
public abstract class BaseActivity extends Activity implements AsyncTaskCallback
{
    
    private Toast toast;
    
    @Override
    public void onProgressUpdate(int type, int pros)
    {
    }
    
    @Override
    public void onPostExecute(int type, Map<String, Object> result) 
    {
    }
    
    @Override
    public void onCancel(int type)
    {
    }
    
    protected void showToastMsg(String msg)
    {
        if (toast == null)
        {
            toast = Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT);
        }
        else
        {
            toast.setText(msg);
        }
        toast.show();
        
    }
    
    protected void showToastMsg(String msg, int time)
    {
        if (toast == null)
        {
            toast = Toast.makeText(getApplicationContext(), msg, time);
        }
        else
        {
            toast.setText(msg);
        }
        toast.show();
        
    }
    
    private final String TAG = "BaseActivity";
    
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
    }
    
    @Override
    public void setContentView(int layoutResID)
    {
        super.setContentView(layoutResID);
    }
    
    @Override
    protected void onDestroy()
    {
        super.onDestroy();
    }
    
    @Override
    protected void onStart()
    {
        super.onStart();
        //SericityUtil.getInstance().checkJiechi(BaseActivity.this);
    }
    
    @Override
    protected void onUserLeaveHint()
    {
        super.onUserLeaveHint();
        //判断活动是否是顶端
    }
    
    @Override
    protected void onResume()
    {
        super.onResume();
    }
}
